package com.odt.outdoor.model.impl;



import com.odt.outdoor.bean.Result;
import com.odt.outdoor.model.BaseModel;
import com.odt.outdoor.model.LoadResultCallback;
import com.odt.outdoor.model.OnBaseModelListener;
import com.odt.outdoor.model.imodel.IOtherModel;
import com.odt.outdoor.net.Callback;
import com.shaomengjie.okhttp.AppException;
import com.shaomengjie.okhttp.HttpRequest;
import com.shaomengjie.okhttp.RequestManager;

/**
 * Created by shaomengjie on 2017/3/14.
 */

public class OtherlModel extends BaseModel implements IOtherModel {
    public OtherlModel(OnBaseModelListener listener) {
        super(listener);
    }


    @Override
    public void loagLogin(String username, String password, final LoadResultCallback<Result> callback) {
        HttpRequest request = new HttpRequest("http://ecpay.1toall.net/api/appAccount/login", HttpRequest.RequestMethod.POST);
        request.put("username", "18936172702");
        request.put("password", "123456");
        request.setCallback(new Callback<Result>() {

            @Override
            public void onSuccess(Result result) {
                callback.onSuccess(result);
            }

            @Override
            public void onFailure(AppException e) {
                callback.onFailure(e.getCode(),e.getMsg());
            }
        });
        request.setOnGlobalExceptionListener(this);
        RequestManager.getInstance().execute("loagLogin",request);
    }
}
